﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MessageRouter.ServiceBroker.Configuration
{
    internal sealed class ConfigurationManager
    {
        private static readonly ConfigurationManager instance = new ConfigurationManager();

        private readonly ServiceBrokerConfigurationSection configuration;

        private ConfigurationManager()
        {
            this.configuration = (ServiceBrokerConfigurationSection)System.Configuration.ConfigurationManager.GetSection("routerModel.ServiceBroker");
        }

        public static ConfigurationManager Current
        {
            get { return instance; }
        }

        public IEnumerable<ServiceBrokerBehaviorConfigurationElement> Behaviors
        {
            get { return this.configuration.Behaviors.OfType<ServiceBrokerBehaviorConfigurationElement>().ToArray(); }
        }
    }
}
